#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__

#include "cocos2d.h"
#include "DrawTraceLayer.h"
#include "BaskWallLayer.h"

class HelloWorld : public cocos2d::Layer
{
public:
    cocos2d::Size m_size;
    cocos2d::Vec2 m_centre;
    // 分数节点
    cocos2d::Label *lab_score;
    
    cocos2d::PhysicsWorld* physicsWorld;
    
    //球代表的物理体
    cocos2d::PhysicsBody *actionBody;
    
    //轨迹层
    DrawTraceLayer* drawTraceLayer;
    
    BaskWallLayer *baskWallLayer;
    
    Node *ballBox;
    Node *ball;
    
    // 投篮是否失败
    bool m_fireFailure;
public:
    static cocos2d::Scene* createScene();

    virtual bool init();
    
    virtual void onEnter();
    virtual void onExit();
    
    void initBall();
    void initBasket();
    
    virtual void updateStart(float delta);
    
    virtual void update(float delta);
    
    // a selector callback
    void menuCloseCallback(cocos2d::Ref* pSender);
    
    virtual bool onContactBegin(const cocos2d::PhysicsContact& contact) ;
    
    // implement the "static create()" method manually
    CREATE_FUNC(HelloWorld);
    
    //回调函数
    //进球
    virtual void onFallIn(Ref* pSender);
    //球跑到外面
    virtual void onOut(Ref* pSender);
    
    virtual void exchangePosition();
    virtual void resetBasket();
};

#endif // __HELLOWORLD_SCENE_H__
